package com.mrd.gtimp.base.entity;

import org.hibernate.annotations.GenericGenerator;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * <p>
 * application name: gtimp
 * <p>
 * copyright: Copyright@2012 明睿达科技有限公司
 */

/**
 * @author qiul
 */
@Entity
@Table(name = "T_SYS_QUESTION")
public class Question implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "aid", strategy = "uuid")
    @GeneratedValue(generator = "aid")
    @Column(name = "QID")
    private String id;

    @Column(name = "CONTENTS")
    private String contents;

    @Column(name = "USERID")
    private String uid;

    @Column(name = "ISCHECK")
    private String ischeck;

    @Column(name = "ISANSWER")
    private String isanswer;

    @Column(name = "SENDTIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date sendtime;

    @OneToMany(mappedBy = "qid", fetch = FetchType.EAGER)
    private List<Answer> answers;

    @Transient
    private int anstotal;                  // 回复数量

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getContents() {
        return contents;
    }

    public void setContents(String contents) {
        this.contents = contents;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getIscheck() {
        return ischeck;
    }

    public void setIscheck(String ischeck) {
        this.ischeck = ischeck;
    }

    public String getIsanswer() {
        return isanswer;
    }

    public void setIsanswer(String isanswer) {
        this.isanswer = isanswer;
    }

    public Date getSendtime() {
        return sendtime;
    }

    public void setSendtime(Date sendtime) {
        this.sendtime = sendtime;
    }

    public List<Answer> getAnswers() {
        return answers;
    }

    public void setAnswers(List<Answer> answers) {
        this.answers = answers;
    }

    public int getAnstotal() {
        return anstotal;
    }

    public void setAnstotal(int anstotal) {
        this.anstotal = anstotal;
    }

    public Question() {
        super();
    }

}
